package com.sqfw.project.wp.controller;


import com.sqfw.framework.web.controller.BaseController;
import com.sqfw.framework.web.domain.AjaxResult;
import com.sqfw.framework.web.page.TableDataInfo;
import com.sqfw.project.wp.domain.WpInfo;
import com.sqfw.project.wp.domain.vo.WpDetailVO;
import com.sqfw.project.wp.service.QualityAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "质检审核")
@RestController
@RequestMapping("/wp/qa/")
public class WpQualityAuditController extends BaseController {

    @Autowired
    private QualityAuditService qualityAuditService;


    @PreAuthorize("@ss.hasAnyPermi('wp:qa,getList')")
    @GetMapping("/list")
    public TableDataInfo getList(WpInfo wpInfo){
        startPage();
        List<WpInfo> list = qualityAuditService.getList(wpInfo);
        return getDataTable(list);
    }

    /**
     * 获取工单表详细信息
     */
    @ApiOperation("查询质检字审核详情")
    @PreAuthorize("@ss.hasAnyPermi('wp:qa,getDetail')")
    @GetMapping(value = "/getDetail/{scid}")
    public AjaxResult<WpDetailVO> getInfo(@PathVariable("scid") String scid)
    {
        return AjaxResult.success(qualityAuditService.showDetail(scid));
    }

    @ApiOperation("查询质检字审核提交")
    @PreAuthorize("@ss.hasAnyPermi('wp:qa,submit')")
    @PostMapping(value = "/submit")
    public AjaxResult submit(WpInfo wpInfo){
        return AjaxResult.success(qualityAuditService.submit(wpInfo));
    }
}
